package demo.hello.bean;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;

@Table("t_person")	//声明了Person对象的数据表
public class Person {
	
	@Column 	//表示该对象属性可以映射到数据库里作为一个字段
	@Id(auto=false) 		//表示该字段为一个自增长的Id,false表示不会忽略主键的值，手动插入
	private int id;
	
	@Column
	@Name		//表示该字段可以用来标识此对象，或者是字符型主键，或者是唯一性约束
	private String name;
	
	public Person(){}
	
	public Person(int id, String name, int age) {
		super();
		this.id = id;
		this.name = name;
		this.age = age;
	}
	
	public String toString() {
		return "id=" + id + ",name=" + name + ",age=" + age;
	}

	@Column
	private int age;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}
}
